package com.bootcamp.java;

import java.util.Arrays;

public class deleteElement {
    public static void main(String[] args) {
        int[] a={1,2,3,2,3,2};

        int element=a[0];
        int count=0;
        for (int i = 1; i < a.length; i++) {
            int s=a[0];
            s^=a[i];
            if (s==0)
                element=a[i];
        }

        for (int i = 0; i < a.length; i++) {
            if (a[i]==element)
                count++;
        }
        int[] b=new int[a.length-count];
        int j=0;
        for (int i=0;i<a.length;i++) {
            if (a[i]!=element)
                b[i]=a[i-=j];
            else
                j++;
        }
        System.out.println(Arrays.toString(b));

    }


}
